﻿@using Db8.Data
@using Db8.ViewModels
@model ClaimViewModel
@{
    ViewBag.Title = "Claim Details";
    ViewData["counterTarget"] = Model.Claim.ClaimId;
}
<section class="content">
    <div style="float:right">@Html.Partial("_Navigation")</div>
    <section class="view-header">
        @Html.ActionLink("Claim Index", "Index") 
        @if (!string.IsNullOrEmpty(Model.Filter))
        {
            <text>&gt; </text>@Html.ActionLink(Model.Filter, "Index", new { filter = Model.Filter })
        }
        &gt; <span previewlength="40">@Html.DisplayFor(model => model.Claim.Statement)</span>
    </section>
    <section class="view-body">
        <div class="edit-container">@Html.Partial("_ClaimView", Model)</div>
        <div class="counter-claims claim-list">
            <div class="existing">
            @foreach (ClaimViewModel CounterClaim in Model.Claim.CounterClaims.Select(cc => ClaimViewModel.FromClaim(cc.Claim)))
            {
                <div class="edit-container">@Html.Partial("_ClaimView", CounterClaim)</div>
            }
            </div>
            @if (User.IsInRole(Db8.Db8Roles.CONTENT_ADMINISTRATOR))
            {
            <div class="pending"></div>
            <div class="edit-container">@Html.Partial("_ClaimNew")</div>
            }
        </div>
    </section>
    <section class="view-underworld">
        <h4>Public Comments</h4>
        <h5 class="warning">NOTE: The "Post to Facebook" option may reset for new posts.</h5>
        <div class="fb-comments" data-href="@Url.Action("Details", "Claim", new { id = Model.Claim.ClaimId }, Request.Url.Scheme)" data-num-posts="4" data-width="860"></div>
    </section>
</section>
@section scripts {
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")"></script>
<script type="text/javascript" src="@Url.Content("~/Scripts/db8-ui.js")"></script>
<script type="text/javascript">
</script>
<div id="fb-root"></div>
<script>    (function (d, s, id) {
        var js, fjs = d.getElementsByTagName(s)[0];
        if (d.getElementById(id)) return;
        js = d.createElement(s); js.id = id;
        js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
        fjs.parentNode.insertBefore(js, fjs);
    } (document, 'script', 'facebook-jssdk'));</script>
}